<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/*Route::middleware('throttle:60,1')->group(function () {
    Route::get('/index', 'API\IndexController@index');
});*/

Route::get('/index', 'API\IndexController@index');
Route::get('/category', 'API\IndexController@category');
Route::get('/topic/{cate}', 'API\IndexController@topic');
Route::get('/detail/{id}', 'API\IndexController@detail');
Route::get('/article/{id}', 'API\IndexController@article');
Route::get('/advertising/{id}', 'API\IndexController@advertising');

Route::middleware('throttle:60,1')->post('/sendRegisterMail', 'API\LoginController@sendRegisterMail');
Route::middleware('throttle:60,1')->post('/register', 'API\LoginController@register');
Route::middleware('throttle:60,1')->post('/login', 'API\LoginController@login');

Route::middleware('token')->group(function () {
    Route::post('/reply/{id}', 'API\IndexController@reply');
    Route::post('/adopt/{replyId}', 'API\IndexController@adopt');
    Route::post('/publish', 'API\IndexController@publish');
    Route::post('/publish/{id}', 'API\IndexController@editPublish');
    Route::post('/password/{userId}', 'API\UserController@password');
    Route::post('/userTopic/{userId}', 'API\UserController@userTopic');
    Route::post('/message/{userId}', 'API\UserController@message');
    Route::post('/isRead/{id?}', 'API\UserController@isRead');
    Route::post('/uploads', 'API\IndexController@uploads');
});
